#ifndef LOGINWINDOW_H
#define LOGINWINDOW_H

#include <QMainWindow>
#include <QNetworkAccessManager>

#include "configfile.h"

namespace Ui {
class LoginWindow;
}

class LoginWindow : public QMainWindow
{
    Q_OBJECT

public:
    enum Status {
        NO_ERROR = 0,
    };
    enum Rect { /* designer original size */
        D_Width = 800,
        D_Height = 400,
    };

    /*explicit */LoginWindow(QWidget *parent);
    ~LoginWindow();
    void resetSignalAndSlot();

private slots:
    void on_pushButtonLogin_clicked();
    void requestFinished(QNetworkReply* reply);
    void requestHomepageFinished(QNetworkReply *reply);

    void on_checkBoxIsAutoLogin_stateChanged(int status);

    void on_pushButtonEchoPassword_pressed();

    void on_pushButtonEchoPassword_released();

private:
    Ui::LoginWindow *ui;
    ConfigFile *settings;
    QString loginUrl;
    QNetworkAccessManager *netManager;       //网络管理类
    QString phpSessionID;

private: /* func */
    Status init();
    Status deinit();

protected:
    void keyReleaseEvent(QKeyEvent *ev) override;
};

#endif // LOGINWINDOW_H
